﻿using System;
using System.Collections.Generic;
using System.Text;
using CYTools.Util;
using System.Data;
using System.Data.SqlClient;
using CYTools.Models.Model;

namespace CYTools.Models.Dao
{
    public class CjInfoDao
    {
        public Database db = new Database();
        /// <summary>
        /// get 厂家 info list
        /// </summary>
        /// <param name="conn"></param>
        /// <returns></returns>
        public List<CjInfo> getCjInfoList(SqlConnection conn)
        {
            List<CjInfo> CjInfoList = new List<CjInfo>();
            string sql = "SELECT Cj_id,Bianma,Quancheng,Jiancheng,Cjlb  FROM 厂家 where Cj_id <>1";
            try
            {
                DataTable dt = db.Squery(sql, conn);
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        CjInfo ui = new CjInfo();
                        ui.Cj_id = row["Cj_id"].ToString();
                        ui.Bianma = row["Bianma"].ToString();
                        ui.Quancheng = row["Quancheng"].ToString();
                        ui.Jiancheng = row["Jiancheng"].ToString();
                        ui.Cjlb = row["Cjlb"].ToString();
                        CjInfoList.Add(ui);
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            return CjInfoList;
        }
    }
}
